import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { ColorInfo } from "./info/ColorInfo";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
type int = number;
//class ColorConfig
    
    export  class ColorConfig
    {
        constructor(arg1: ConstructorBlock)
        {
            
            this._dataColor = new Map<any, any> /* flash.utils.Dictionary */();
            if (ColorConfig._instance != null) 
            {
                throw new Error(" ColorConfig 单例 ");
            }
            ColorConfig._instance = this;
            this.parseColorXML(ConfigManager.instance.getObjectByFileName("color.xml"));
            return;
        }

        /* internal  */parseColorXML(arg1: Object): void
        {
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc1=arg1.items as Array<any>;
            var loc6=0;
            var loc7=loc1;
            for(loc2 of loc7) 
            {
                loc3 = loc2.type.toString();
                var loc8=0;
                var loc9=loc2.item as Array<any>;
                for(loc4 of loc9) 
                {
                    (loc5 = new ColorInfo()).type = StringHelper.getString(loc3);
                    loc5.color = StringHelper.getString(loc4.value);
                    loc5.id = StringHelper.getString(loc4.id);
                    loc5.colorText = StringHelper.getString(loc4.text);
                    this.addItem(loc5);
                }
            }
            return;
        }

        public addItem(arg1: ColorInfo): void
        {
            this._dataColor[arg1.type + "-" + arg1.id] = arg1;
            return;
        }

        public getItem(arg1: string, arg2: string): ColorInfo
        {
            return this._dataColor[arg1 + "-" + arg2] as ColorInfo;
        }

        public getItemColor(arg1: int): ColorInfo
        {
            return this._dataColor["item" + "-" + arg1];
        }

        public getRumorColor(arg1: int): ColorInfo
        {
            return this._dataColor["rumor" + "-" + arg1];
        }

        public getGradeColor(arg1: int): ColorInfo
        {
            return this._dataColor["grade" + "-" + arg1];
        }

        public getItemColorString(arg1: int): string
        {
            var loc1="";
            var loc2=this.getItemColor(arg1);
            if (loc2) 
            {
                loc1 = loc2.color;
            }
            return loc1;
        }

        public getCampColor(arg1: int): ColorInfo
        {
            return this._dataColor["country" + "-" + arg1];
        }

        public getCountryColor(arg1: int): ColorInfo
        {
            var loc1=this._dataColor["country" + "-" + arg1];
            if (!loc1) 
            {
                loc1 = this._dataColor["country-0"];
            }
            return loc1;
        }

        public getChatColor(arg1: string): ColorInfo
        {
            return this._dataColor["chat" + "-" + arg1];
        }

        public getVIPColor(arg1: int): ColorInfo
        {
            var loc1=this._dataColor["vip" + "-" + arg1];
            if (!loc1) 
            {
                loc1 = this._dataColor["vip-1"];
            }
            return loc1;
        }

        public getTaskColor(arg1: string): ColorInfo
        {
            return this._dataColor["task" + "-" + arg1];
        }

        public getChartsColor(arg1: int): ColorInfo
        {
            return this._dataColor["charts" + "-" + arg1];
        }

        public getCoinColor(arg1: int): ColorInfo
        {
            return this._dataColor["coin" + "-" + arg1];
        }

        public getGoldColor(arg1: int): ColorInfo
        {
            return this._dataColor["gold" + "-" + arg1];
        }

        public getCycleColor(arg1: int): ColorInfo
        {
            return this._dataColor["cycle" + "-" + arg1];
        }

        public getMountAddValue(arg1: int): ColorInfo
        {
            return this._dataColor["MountAddValue-" + arg1];
        }

        public getWuxingColor(arg1: int): string
        {
            return (this._dataColor["wuxing-" + arg1] as ColorInfo).color;
        }

        public static get instance(): ColorConfig
        {
            if (ColorConfig._instance == null) 
            {
                ColorConfig._instance = new ColorConfig(new ConstructorBlock());
            }
            return ColorConfig._instance;
        }

        /* internal */ /* var */_dataColor: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: ColorConfig;
    }
}


class ConstructorBlock
{
    public ConstructorBlock()
    {
        
        return;
    }
